package com.yuyou.activity.util.enums;

public class ActivityGroupJobEnums {

	/**1：拼团成功通知,2:shipin.com推送,3:sp拼团成功通知**/
	public enum type{		
		GROUP(1) , SHIPIN(2) , GROUP_SHIPIN(3);
		type(int value){
			this.value=value;
		}		
		private int value;
		public int getValue() {
			return value;
		}			
	}
	
	public enum tag{
		GROUP("group") , SHIPIN("shipin") , GROUP_SHIPIN("shipin_group");
		tag(String value){
			this.value=value;
		}		
		private String value;
		public String getValue() {
			return value;
		}			
	}

	/**
	 * 状态：0:待处理，1:已分派，2:处理中，3:成功，4:失败，5:取消
	 *
	 */
	public enum status{		
		init(0),sended(1),dealing(2),success(3),fail(4),cancel(5);
		status(int value){
			this.value=value;
		}		
		private int value;
		public int getValue() {
			return value;
		}			
	}

	/**
	 * 最大重试次数
	 * @author ZY
	 *
	 */
	public enum maxTime{
		GROUP(0) , SHIPIN(6) , GROUP_SHIPIN(0);
		maxTime(int maxTime){
			this.maxTime=maxTime;
		}
		private int maxTime;

		public static int getByType(int type) {
			if(type == ActivityGroupJobEnums.type.GROUP.getValue()){
				return GROUP.getMaxTime();
			}else if(type == ActivityGroupJobEnums.type.SHIPIN.getValue()){
				return SHIPIN.getMaxTime();
			}
			return 0;
		}

		public int getMaxTime() {
			return maxTime;
		}
	}

	public enum needRetry{
		GROUP(0) , SHIPIN(1) , GROUP_SHIPIN(0);
		private int needRetry;
		needRetry(int needRetry){
			this.needRetry=needRetry;
		}
		public static int getByType(int type) {
			if(type == ActivityGroupJobEnums.type.GROUP.getValue()){
				return GROUP.needRetry();
			}else if(type == ActivityGroupJobEnums.type.SHIPIN.getValue()){
				return SHIPIN.needRetry();
			}
			return 0;
		}
		public int needRetry() {
			return needRetry;
		}
	}

	/**
	 * 间隔（分钟）
	 * @author ZY
	 *
	 */
	public enum interval{
		i1(1) , i2(5) , i3(10) , i4(20) , i5(40) , i6(60) , i7(120) , i8(240);
		interval(int maxTime){
			this.maxTime=maxTime;
		}

		public static int getMaxByTimes(int time){
			int times = 240;
			switch (time){
				case 1 : times = interval.i1.getValue();
				break;
				case 2 : times = interval.i2.getValue();
				break;
				case 3 : times = interval.i3.getValue();
				break;
				case 4 : times = interval.i4.getValue();
				break;
				case 5 : times = interval.i5.getValue();
				break;
				case 6 : times = interval.i6.getValue();
				break;
				case 7 : times = interval.i7.getValue();
				break;
				case 8 : times = interval.i8.getValue();
				break;
				default: times = interval.i8.getValue();
			}
			return times;
		}

		private int maxTime;

		public int getValue() {
			return maxTime;
		}
	}

}
